import WMap from 'http://139.9.35.40/wmap/wmap.es.js'

const map = new WMap.Map('map', {
	center: new WMap.LngLat(116.479662,39.996956),
  zoom: 15
})
map.on('click', e => {
	console.log(e.lngLat)
})

let tools = new WMap.Tool(map)
let tool = document.querySelector('#tool')
tool.onchange = () => {
  switch (tool.value) {
    case '':
      tools.close()
      break
    case 'distance':
      tools.distance()
      break
    case 'area':
      tools.area()
      break
  }
}

tools.on('done', e => {
  console.log(e)
})
